package asteroids.model.programs.expressions.BasicExpressions;


import be.kuleuven.cs.som.annotate.Basic;
import asteroids.model.programs.expressions.BasicExpression;
import asteroids.model.programs.types.Type;
/**
 * Class that of double literals
 * @author r0297214
 *
 */

public class DoubleLiteral extends BasicExpression {
	
	/**
	 * 
	 * Initialize this new double literal with given value.
	 *
	 * @param  value
	 *         The value for this new double literal.
	 * @post   The value of this new double literal is equal to
	 *         the given value.
	 *       | new.getValue() == value
	 */
	public DoubleLiteral(double value, int line, int column){
		super(line, column);
		this.value = value;
	}
	
	/**
	 * returns the value of this double literal
	 * @return ...
	 * 		   | this.value
	 */
	@Basic
	public double getValue(){
		return this.value;
	}
	
	/**
	 * Sets the value of this double literal to the given value.
	 * @param newValue
	 * 		  the new value to be set
	 * @post ...
	 * 		 |(new this).getValue() = newValue;
	 */
	@Basic
	public void setValue(double newValue){
		value = newValue;
	}
	
	private double value;
	
	/**
	 * @return this BasicExpression.
	 */
	@Override
	public BasicExpression getResult() {
		return this;
	}
	
	/**
	 * @return the textual form of this basic expression
	 * 			| return String.valueOf(value)
	 */
	@Override
	public String toString() {
		return String.valueOf(value);
	}
	
	@Override
	public Type getType(){
		return Type.DOUBLE;
	}
	
}
